package ua.kpi.fpm.km61.strat.sp.tests;

import static org.junit.Assert.*;

import java.util.Collection;
import java.util.Set;

import org.junit.Test;

import ua.kpi.fpm.km61.strat.sp.rules.Rule;
import ua.kpi.fpm.km61.strat.sp.rules.Terminal;
import ua.kpi.fpm.km61.strat.sp.util.FileProcessor;

public class FileProcessorTest {

	@Test
	public void testParseRulesCount() {
		Set<Terminal> terminals = FileProcessor.parseTerminals();
		Collection<Rule> rules = FileProcessor.parseRules(terminals);
		assertEquals(118, rules.size());
	}

	@Test
	public void testParseRulesNameLeft() {
		Set<Terminal> terminals = FileProcessor.parseTerminals();
		Collection<Rule> rules = FileProcessor.parseRules(terminals);
		assertEquals("goal", rules.iterator().next().getIn().getName());
	}
	
	@Test
	public void testParseRulesNameRight() {
		Set<Terminal> terminals = FileProcessor.parseTerminals();
		Collection<Rule> rules = FileProcessor.parseRules(terminals);
		System.out.println(rules.iterator().next().getChain().getOut());
		assertEquals("classes", rules.iterator().next().getChain().getOut().get(0).getName());
	}
	
	@Test
	public void testParseTerminalsCount() {
		Set<Terminal> terminals = FileProcessor.parseTerminals();
		System.out.println( terminals.toString());
		assertEquals(42, terminals.size());
	}

}
